package com.spring.example.service;

import java.util.List;

import com.spring.example.domain.Product;

public class SimpleProductManager implements ProductManager {

	/**
	 * 
	 */
	private static final long serialVersionUID = 6782496694316035709L;

	private List<Product> products;
	
	public List<Product> getProducts() {
		return products;
    }

    public void increasePrice(int percentage) {
    	if (products != null) {
            for (Product product : products) {
                double newPrice = product.getPrice().doubleValue() * 
                                    (100 + percentage)/100;
                product.setPrice(newPrice);
            }
        }     
    }

    public void setProducts(List<Product> products) {
    	this.products = products;     
    }

}
